#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int reverse(int n)
{
    int result = 0;
    int c = 0;

    while(n > 0)
    {
        c = n % 10;
        n = (n - c) / 10;

        result = result * 10 + c;
    }
    return result;
}

int str2int(char str[10])
{
    int val = 0;
    int i = 0;
    for(i = 0; i < strlen(str);  i++)
    {
        val *= 10;
        val += (str[i] - '0');
    }
    return val;
}

void process()
{
    int N = 0;
    int i = 0;
    int num1 = 0, num2 = 0;
    int rvsnum1 = 0, rvsnum2 = 0;

    scanf("%d", &N);

    for(i = 0; i < N; i++)
    {
        scanf("%d", &num1);
        scanf("%d", &num2);
        rvsnum1 = reverse(num1);
        rvsnum2 = reverse(num2);
        printf("%d\r\n", reverse(rvsnum1 + rvsnum2));
    }
}

int main()
{
    //freopen("bin\\debug\\in.txt", "r", stdin);

    process();

    return 0;
}
